{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Block Aligner Accuracy Analysis and Visualizations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This notebook contains code for collecting, cleaning, and analyzing data produced by block aligner's experiments.\n",
    "\n",
    "To run this, you will need to install all the libraries imported below, along with [altair-saver](https://github.com/altair-viz/altair_saver) and [altair-data-server](https://github.com/altair-viz/altair_data_server), which has some extra dependencies for PDF saving.\n",
    "\n",
    "Run each cell one by one to reproduce the experiments."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:47:11.050100Z",
     "iopub.status.busy": "2023-02-27T11:47:11.049343Z",
     "iopub.status.idle": "2023-02-27T11:47:11.914583Z",
     "shell.execute_reply": "2023-02-27T11:47:11.915081Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DataTransformerRegistry.enable('data_server')"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import altair as alt\n",
    "from altair_saver import save\n",
    "from altair import datum\n",
    "import pandas as pd\n",
    "from io import StringIO\n",
    "\n",
    "alt.data_transformers.enable(\"data_server\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:47:11.918767Z",
     "iopub.status.busy": "2023-02-27T11:47:11.918278Z",
     "iopub.status.idle": "2023-02-27T11:47:11.920120Z",
     "shell.execute_reply": "2023-02-27T11:47:11.920612Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "def csv_to_pandas(csv, d = \"\\\\s*,\\\\s*\", t = None):\n",
    "    s = StringIO(\"\\n\".join(csv))\n",
    "    data = pd.read_csv(s, sep = d, thousands = t, comment = \"#\", engine = \"python\")\n",
    "    return data\n",
    "\n",
    "def file_to_pandas(path):\n",
    "    return pd.read_csv(path, sep = \"\\\\s*,\\\\s*\", comment = \"#\", engine = \"python\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Block Aligner Image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:47:11.923819Z",
     "iopub.status.busy": "2023-02-27T11:47:11.923340Z",
     "iopub.status.idle": "2023-02-27T11:47:20.960034Z",
     "shell.execute_reply": "2023-02-27T11:47:20.960736Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "path: vis/block_img1.png, img size: 660 x 549\r\n",
      "path: vis/block_img2.png, img size: 384 x 428\r\n"
     ]
    }
   ],
   "source": [
    "!cd .. && cargo run --example block_img --release --features simd_avx2 --quiet -- vis/block_img1.png vis/block_img2.png"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src = \"block_img1.png\" width = \"300px\" />\n",
    "<img src = \"block_img2.png\" width = \"300px\" />"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Random Data Accuracy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:47:20.965547Z",
     "iopub.status.busy": "2023-02-27T11:47:20.964993Z",
     "iopub.status.idle": "2023-02-27T11:51:13.096340Z",
     "shell.execute_reply": "2023-02-27T11:51:13.095918Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['',\n",
       " 'len, k, insert, iter, max size, wrong, wrong % error, wrong min, wrong max',\n",
       " '',\n",
       " '',\n",
       " '100, 10, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 10, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 10, true, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 10, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 20, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 20, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 20, true, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 20, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 50, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 50, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 50, true, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '100, 50, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 100, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 100, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 100, true, 100, 32, 99, 0.6398763123199956, 7, 1001',\n",
       " '',\n",
       " '',\n",
       " '1000, 100, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 200, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 200, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 200, true, 100, 32, 97, 0.7973371403880799, 11, 824',\n",
       " '',\n",
       " '',\n",
       " '1000, 200, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 500, false, 100, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 500, false, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '1000, 500, true, 100, 32, 96, 1.6462162143616295, 1, 511',\n",
       " '',\n",
       " '',\n",
       " '1000, 500, true, 100, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 1000, false, 10, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 1000, false, 10, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 1000, true, 10, 32, 10, 0.7274038361407913, 2402, 9940',\n",
       " '',\n",
       " '',\n",
       " '10000, 1000, true, 10, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 2000, false, 10, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 2000, false, 10, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 2000, true, 10, 32, 10, 0.8624608080671005, 2201, 7736',\n",
       " '',\n",
       " '',\n",
       " '10000, 2000, true, 10, 2048, 5, 0.001297233522793133, 1, 14',\n",
       " '',\n",
       " '',\n",
       " '10000, 5000, false, 10, 32, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 5000, false, 10, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '10000, 5000, true, 10, 32, 10, 1.9540110615043058, 365, 4091',\n",
       " '',\n",
       " '',\n",
       " '10000, 5000, true, 10, 2048, 0, NaN, 2147483647, -2147483648',\n",
       " '',\n",
       " '',\n",
       " '# total: 2520, wrong: 327',\n",
       " '# Done!']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd .. && cargo run --example accuracy --release --features simd_avx2 --quiet\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:51:13.099412Z",
     "iopub.status.busy": "2023-02-27T11:51:13.099020Z",
     "iopub.status.idle": "2023-02-27T11:51:13.113831Z",
     "shell.execute_reply": "2023-02-27T11:51:13.114111Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>len</th>\n",
       "      <th>k</th>\n",
       "      <th>insert</th>\n",
       "      <th>iter</th>\n",
       "      <th>max size</th>\n",
       "      <th>wrong</th>\n",
       "      <th>wrong % error</th>\n",
       "      <th>wrong min</th>\n",
       "      <th>wrong max</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>100</td>\n",
       "      <td>10</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>100</td>\n",
       "      <td>10</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>100</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>100</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>100</td>\n",
       "      <td>20</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>100</td>\n",
       "      <td>20</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>100</td>\n",
       "      <td>20</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>100</td>\n",
       "      <td>20</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>100</td>\n",
       "      <td>50</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>100</td>\n",
       "      <td>50</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>100</td>\n",
       "      <td>50</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>100</td>\n",
       "      <td>50</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>99</td>\n",
       "      <td>0.639876</td>\n",
       "      <td>7</td>\n",
       "      <td>1001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>1000</td>\n",
       "      <td>200</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>1000</td>\n",
       "      <td>200</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>1000</td>\n",
       "      <td>200</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>97</td>\n",
       "      <td>0.797337</td>\n",
       "      <td>11</td>\n",
       "      <td>824</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1000</td>\n",
       "      <td>200</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1000</td>\n",
       "      <td>500</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1000</td>\n",
       "      <td>500</td>\n",
       "      <td>False</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1000</td>\n",
       "      <td>500</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>32</td>\n",
       "      <td>96</td>\n",
       "      <td>1.646216</td>\n",
       "      <td>1</td>\n",
       "      <td>511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1000</td>\n",
       "      <td>500</td>\n",
       "      <td>True</td>\n",
       "      <td>100</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>10000</td>\n",
       "      <td>1000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>10000</td>\n",
       "      <td>1000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>10000</td>\n",
       "      <td>1000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>10</td>\n",
       "      <td>0.727404</td>\n",
       "      <td>2402</td>\n",
       "      <td>9940</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>10000</td>\n",
       "      <td>1000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>10000</td>\n",
       "      <td>2000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>10000</td>\n",
       "      <td>2000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>10000</td>\n",
       "      <td>2000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>10</td>\n",
       "      <td>0.862461</td>\n",
       "      <td>2201</td>\n",
       "      <td>7736</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>10000</td>\n",
       "      <td>2000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>5</td>\n",
       "      <td>0.001297</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>10000</td>\n",
       "      <td>5000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>10000</td>\n",
       "      <td>5000</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>10000</td>\n",
       "      <td>5000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>10</td>\n",
       "      <td>1.954011</td>\n",
       "      <td>365</td>\n",
       "      <td>4091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>10000</td>\n",
       "      <td>5000</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>2048</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2147483647</td>\n",
       "      <td>-2147483648</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      len     k  insert  iter  max size  wrong  wrong % error   wrong min  \\\n",
       "0     100    10   False   100        32      0            NaN  2147483647   \n",
       "1     100    10   False   100      2048      0            NaN  2147483647   \n",
       "2     100    10    True   100        32      0            NaN  2147483647   \n",
       "3     100    10    True   100      2048      0            NaN  2147483647   \n",
       "4     100    20   False   100        32      0            NaN  2147483647   \n",
       "5     100    20   False   100      2048      0            NaN  2147483647   \n",
       "6     100    20    True   100        32      0            NaN  2147483647   \n",
       "7     100    20    True   100      2048      0            NaN  2147483647   \n",
       "8     100    50   False   100        32      0            NaN  2147483647   \n",
       "9     100    50   False   100      2048      0            NaN  2147483647   \n",
       "10    100    50    True   100        32      0            NaN  2147483647   \n",
       "11    100    50    True   100      2048      0            NaN  2147483647   \n",
       "12   1000   100   False   100        32      0            NaN  2147483647   \n",
       "13   1000   100   False   100      2048      0            NaN  2147483647   \n",
       "14   1000   100    True   100        32     99       0.639876           7   \n",
       "15   1000   100    True   100      2048      0            NaN  2147483647   \n",
       "16   1000   200   False   100        32      0            NaN  2147483647   \n",
       "17   1000   200   False   100      2048      0            NaN  2147483647   \n",
       "18   1000   200    True   100        32     97       0.797337          11   \n",
       "19   1000   200    True   100      2048      0            NaN  2147483647   \n",
       "20   1000   500   False   100        32      0            NaN  2147483647   \n",
       "21   1000   500   False   100      2048      0            NaN  2147483647   \n",
       "22   1000   500    True   100        32     96       1.646216           1   \n",
       "23   1000   500    True   100      2048      0            NaN  2147483647   \n",
       "24  10000  1000   False    10        32      0            NaN  2147483647   \n",
       "25  10000  1000   False    10      2048      0            NaN  2147483647   \n",
       "26  10000  1000    True    10        32     10       0.727404        2402   \n",
       "27  10000  1000    True    10      2048      0            NaN  2147483647   \n",
       "28  10000  2000   False    10        32      0            NaN  2147483647   \n",
       "29  10000  2000   False    10      2048      0            NaN  2147483647   \n",
       "30  10000  2000    True    10        32     10       0.862461        2201   \n",
       "31  10000  2000    True    10      2048      5       0.001297           1   \n",
       "32  10000  5000   False    10        32      0            NaN  2147483647   \n",
       "33  10000  5000   False    10      2048      0            NaN  2147483647   \n",
       "34  10000  5000    True    10        32     10       1.954011         365   \n",
       "35  10000  5000    True    10      2048      0            NaN  2147483647   \n",
       "\n",
       "     wrong max  \n",
       "0  -2147483648  \n",
       "1  -2147483648  \n",
       "2  -2147483648  \n",
       "3  -2147483648  \n",
       "4  -2147483648  \n",
       "5  -2147483648  \n",
       "6  -2147483648  \n",
       "7  -2147483648  \n",
       "8  -2147483648  \n",
       "9  -2147483648  \n",
       "10 -2147483648  \n",
       "11 -2147483648  \n",
       "12 -2147483648  \n",
       "13 -2147483648  \n",
       "14        1001  \n",
       "15 -2147483648  \n",
       "16 -2147483648  \n",
       "17 -2147483648  \n",
       "18         824  \n",
       "19 -2147483648  \n",
       "20 -2147483648  \n",
       "21 -2147483648  \n",
       "22         511  \n",
       "23 -2147483648  \n",
       "24 -2147483648  \n",
       "25 -2147483648  \n",
       "26        9940  \n",
       "27 -2147483648  \n",
       "28 -2147483648  \n",
       "29 -2147483648  \n",
       "30        7736  \n",
       "31          14  \n",
       "32 -2147483648  \n",
       "33 -2147483648  \n",
       "34        4091  \n",
       "35 -2147483648  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = csv_to_pandas(output)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:51:13.116975Z",
     "iopub.status.busy": "2023-02-27T11:51:13.116495Z",
     "iopub.status.idle": "2023-02-27T11:51:13.125020Z",
     "shell.execute_reply": "2023-02-27T11:51:13.124063Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data[\"% wrong\"] = data[\"wrong\"] / data[\"iter\"]\n",
    "data[\"k %\"] = data[\"k\"] / data[\"len\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Error Rate on Random DNA Sequences with 10% Insert"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:51:13.138761Z",
     "iopub.status.busy": "2023-02-27T11:51:13.138187Z",
     "iopub.status.idle": "2023-02-27T11:51:14.456344Z",
     "shell.execute_reply": "2023-02-27T11:51:14.456756Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-508a01971152403f99c79432b7608d84\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-508a01971152403f99c79432b7608d84\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-508a01971152403f99c79432b7608d84\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/f12ec3c265778ccefbe7f9c857182a6c.json\"}, \"mark\": {\"type\": \"point\", \"filled\": true, \"opacity\": 1}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"max size\"}, \"row\": {\"type\": \"nominal\", \"field\": \"len\", \"header\": {\"title\": \"length\"}}, \"shape\": {\"type\": \"nominal\", \"field\": \"max size\"}, \"x\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"% wrong\"}, \"y\": {\"type\": \"nominal\", \"axis\": {\"format\": \"~%\", \"grid\": true}, \"field\": \"k %\"}}, \"height\": 50, \"transform\": [{\"filter\": \"(datum.insert === true)\"}], \"width\": 100, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_point(opacity = 1, filled = True).encode(\n",
    "    x = alt.X(\"% wrong\", axis = alt.Axis(format = \"%\")),\n",
    "    y = alt.Y(\"k %:N\", axis = alt.Axis(format = \"~%\", grid = True)),\n",
    "    color = \"max size:N\",\n",
    "    shape = \"max size:N\",\n",
    "    row = alt.Row(\"len:N\", header = alt.Header(title = \"length\"))\n",
    ").transform_filter(\n",
    "    datum.insert == True\n",
    ").properties(\n",
    "    width = 100,\n",
    "    height = 50\n",
    ")\n",
    "save(c, \"random_dna_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Uniclust 30 Data Accuracy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:51:14.460237Z",
     "iopub.status.busy": "2023-02-27T11:51:14.459790Z",
     "iopub.status.idle": "2023-02-27T11:54:08.954095Z",
     "shell.execute_reply": "2023-02-27T11:54:08.954544Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['# seq identity is lower bound (inclusive)',\n",
       " 'dataset, size, seq identity, count, wrong, wrong % error',\n",
       " 'uc30_0.95, 32-32, 0, 0, 0, NaN',\n",
       " 'uc30_0.95, 32-32, 0.1, 0, 0, NaN',\n",
       " 'uc30_0.95, 32-32, 0.2, 14, 0, NaN',\n",
       " 'uc30_0.95, 32-32, 0.3, 873, 45, 0.24234488792701261',\n",
       " 'uc30_0.95, 32-32, 0.4, 1166, 70, 0.23740147684159452',\n",
       " 'uc30_0.95, 32-32, 0.5, 951, 39, 0.22458752668094342',\n",
       " 'uc30_0.95, 32-32, 0.6, 923, 30, 0.2423639248577639',\n",
       " 'uc30_0.95, 32-32, 0.7, 789, 19, 0.23070399690337745',\n",
       " 'uc30_0.95, 32-32, 0.8, 747, 9, 0.2314009291547539',\n",
       " 'uc30_0.95, 32-32, 0.9, 1537, 18, 0.14197227628986994',\n",
       " '',\n",
       " '# total: 7000, wrong: 230, wrong % error: 0.22858669521170225, length avg: 329.554, length min: 22, length max: 8881, dp fraction: 0.3389349961353417',\n",
       " '',\n",
       " 'uc30_0.95, 32-256, 0, 0, 0, NaN',\n",
       " 'uc30_0.95, 32-256, 0.1, 0, 0, NaN',\n",
       " 'uc30_0.95, 32-256, 0.2, 14, 0, NaN',\n",
       " 'uc30_0.95, 32-256, 0.3, 873, 10, 0.022419704677810615',\n",
       " 'uc30_0.95, 32-256, 0.4, 1166, 11, 0.0640908027337777',\n",
       " 'uc30_0.95, 32-256, 0.5, 951, 5, 0.06678752297229766',\n",
       " 'uc30_0.95, 32-256, 0.6, 923, 9, 0.04391515678016153',\n",
       " 'uc30_0.95, 32-256, 0.7, 789, 4, 0.023700475250152283',\n",
       " 'uc30_0.95, 32-256, 0.8, 747, 1, 0.0006338028169014084',\n",
       " 'uc30_0.95, 32-256, 0.9, 1537, 4, 0.05817779039335834',\n",
       " '',\n",
       " '# total: 7000, wrong: 44, wrong % error: 0.04514810836644425, length avg: 329.554, length min: 22, length max: 8881, dp fraction: 0.3654793322322297',\n",
       " '',\n",
       " 'uc30_0.95, 256-256, 0, 0, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.1, 0, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.2, 14, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.3, 873, 1, 0.029182542431589884',\n",
       " 'uc30_0.95, 256-256, 0.4, 1166, 2, 0.015912013783823824',\n",
       " 'uc30_0.95, 256-256, 0.5, 951, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.6, 923, 1, 0.14847403884264765',\n",
       " 'uc30_0.95, 256-256, 0.7, 789, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.8, 747, 0, NaN',\n",
       " 'uc30_0.95, 256-256, 0.9, 1537, 0, NaN',\n",
       " '',\n",
       " '# total: 7000, wrong: 4, wrong % error: 0.052370152210471296, length avg: 329.554, length min: 22, length max: 8881, dp fraction: 4.221035489298381',\n",
       " '',\n",
       " 'uc30, 32-32, 0, 0, 0, NaN',\n",
       " 'uc30, 32-32, 0.1, 0, 0, NaN',\n",
       " 'uc30, 32-32, 0.2, 192, 82, 0.9275327360430471',\n",
       " 'uc30, 32-32, 0.3, 1170, 288, 0.5938895288958876',\n",
       " 'uc30, 32-32, 0.4, 1182, 272, 0.5563610451866828',\n",
       " 'uc30, 32-32, 0.5, 1160, 229, 0.5338615587300842',\n",
       " 'uc30, 32-32, 0.6, 1044, 192, 0.5196576365562074',\n",
       " 'uc30, 32-32, 0.7, 847, 103, 0.4959494251346888',\n",
       " 'uc30, 32-32, 0.8, 694, 86, 0.47644760063092073',\n",
       " 'uc30, 32-32, 0.9, 711, 19, 0.25554500500876537',\n",
       " '',\n",
       " '# total: 7000, wrong: 1271, wrong % error: 0.564413277478051, length avg: 302.51342857142856, length min: 25, length max: 8293, dp fraction: 0.35536869224678297',\n",
       " '',\n",
       " 'uc30, 32-256, 0, 0, 0, NaN',\n",
       " 'uc30, 32-256, 0.1, 0, 0, NaN',\n",
       " 'uc30, 32-256, 0.2, 192, 12, 0.14227202149727955',\n",
       " 'uc30, 32-256, 0.3, 1170, 49, 0.12495803143160221',\n",
       " 'uc30, 32-256, 0.4, 1182, 49, 0.12113074192604727',\n",
       " 'uc30, 32-256, 0.5, 1160, 35, 0.15550386498366273',\n",
       " 'uc30, 32-256, 0.6, 1044, 32, 0.11973947097066927',\n",
       " 'uc30, 32-256, 0.7, 847, 18, 0.06996993682039082',\n",
       " 'uc30, 32-256, 0.8, 694, 21, 0.08632626264571577',\n",
       " 'uc30, 32-256, 0.9, 711, 8, 0.045885200156420294',\n",
       " '',\n",
       " '# total: 7000, wrong: 224, wrong % error: 0.11821118070339384, length avg: 302.51342857142856, length min: 25, length max: 8293, dp fraction: 0.44600432314797367',\n",
       " '',\n",
       " 'uc30, 256-256, 0, 0, 0, NaN',\n",
       " 'uc30, 256-256, 0.1, 0, 0, NaN',\n",
       " 'uc30, 256-256, 0.2, 192, 0, NaN',\n",
       " 'uc30, 256-256, 0.3, 1170, 7, 0.3835458905002951',\n",
       " 'uc30, 256-256, 0.4, 1182, 4, 0.7080088654647194',\n",
       " 'uc30, 256-256, 0.5, 1160, 7, 0.4602842002549759',\n",
       " 'uc30, 256-256, 0.6, 1044, 5, 0.3023075188513019',\n",
       " 'uc30, 256-256, 0.7, 847, 2, 0.23043440955768113',\n",
       " 'uc30, 256-256, 0.8, 694, 1, 0.0544986745672852',\n",
       " 'uc30, 256-256, 0.9, 711, 1, 0.0690854119425548',\n",
       " '',\n",
       " '# total: 7000, wrong: 27, wrong % error: 0.4012902443343513, length avg: 302.51342857142856, length min: 25, length max: 8293, dp fraction: 4.391380248306236',\n",
       " '',\n",
       " '# Done!']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd .. && cargo run --example uc_accuracy --release --features simd_avx2 --quiet\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:08.970472Z",
     "iopub.status.busy": "2023-02-27T11:54:08.969482Z",
     "iopub.status.idle": "2023-02-27T11:54:08.972815Z",
     "shell.execute_reply": "2023-02-27T11:54:08.973259Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>size</th>\n",
       "      <th>seq identity</th>\n",
       "      <th>count</th>\n",
       "      <th>wrong</th>\n",
       "      <th>wrong % error</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.2</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.3</td>\n",
       "      <td>873</td>\n",
       "      <td>45</td>\n",
       "      <td>0.242345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1166</td>\n",
       "      <td>70</td>\n",
       "      <td>0.237401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.5</td>\n",
       "      <td>951</td>\n",
       "      <td>39</td>\n",
       "      <td>0.224588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.6</td>\n",
       "      <td>923</td>\n",
       "      <td>30</td>\n",
       "      <td>0.242364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.7</td>\n",
       "      <td>789</td>\n",
       "      <td>19</td>\n",
       "      <td>0.230704</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.8</td>\n",
       "      <td>747</td>\n",
       "      <td>9</td>\n",
       "      <td>0.231401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.9</td>\n",
       "      <td>1537</td>\n",
       "      <td>18</td>\n",
       "      <td>0.141972</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.2</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.3</td>\n",
       "      <td>873</td>\n",
       "      <td>10</td>\n",
       "      <td>0.022420</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1166</td>\n",
       "      <td>11</td>\n",
       "      <td>0.064091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.5</td>\n",
       "      <td>951</td>\n",
       "      <td>5</td>\n",
       "      <td>0.066788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.6</td>\n",
       "      <td>923</td>\n",
       "      <td>9</td>\n",
       "      <td>0.043915</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.7</td>\n",
       "      <td>789</td>\n",
       "      <td>4</td>\n",
       "      <td>0.023700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.8</td>\n",
       "      <td>747</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.9</td>\n",
       "      <td>1537</td>\n",
       "      <td>4</td>\n",
       "      <td>0.058178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.2</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.3</td>\n",
       "      <td>873</td>\n",
       "      <td>1</td>\n",
       "      <td>0.029183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1166</td>\n",
       "      <td>2</td>\n",
       "      <td>0.015912</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.5</td>\n",
       "      <td>951</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.6</td>\n",
       "      <td>923</td>\n",
       "      <td>1</td>\n",
       "      <td>0.148474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.7</td>\n",
       "      <td>789</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.8</td>\n",
       "      <td>747</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.9</td>\n",
       "      <td>1537</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.2</td>\n",
       "      <td>192</td>\n",
       "      <td>82</td>\n",
       "      <td>0.927533</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.3</td>\n",
       "      <td>1170</td>\n",
       "      <td>288</td>\n",
       "      <td>0.593890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1182</td>\n",
       "      <td>272</td>\n",
       "      <td>0.556361</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1160</td>\n",
       "      <td>229</td>\n",
       "      <td>0.533862</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.6</td>\n",
       "      <td>1044</td>\n",
       "      <td>192</td>\n",
       "      <td>0.519658</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.7</td>\n",
       "      <td>847</td>\n",
       "      <td>103</td>\n",
       "      <td>0.495949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.8</td>\n",
       "      <td>694</td>\n",
       "      <td>86</td>\n",
       "      <td>0.476448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0.9</td>\n",
       "      <td>711</td>\n",
       "      <td>19</td>\n",
       "      <td>0.255545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.2</td>\n",
       "      <td>192</td>\n",
       "      <td>12</td>\n",
       "      <td>0.142272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.3</td>\n",
       "      <td>1170</td>\n",
       "      <td>49</td>\n",
       "      <td>0.124958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1182</td>\n",
       "      <td>49</td>\n",
       "      <td>0.121131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1160</td>\n",
       "      <td>35</td>\n",
       "      <td>0.155504</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.6</td>\n",
       "      <td>1044</td>\n",
       "      <td>32</td>\n",
       "      <td>0.119739</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.7</td>\n",
       "      <td>847</td>\n",
       "      <td>18</td>\n",
       "      <td>0.069970</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.8</td>\n",
       "      <td>694</td>\n",
       "      <td>21</td>\n",
       "      <td>0.086326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0.9</td>\n",
       "      <td>711</td>\n",
       "      <td>8</td>\n",
       "      <td>0.045885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.2</td>\n",
       "      <td>192</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.3</td>\n",
       "      <td>1170</td>\n",
       "      <td>7</td>\n",
       "      <td>0.383546</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.4</td>\n",
       "      <td>1182</td>\n",
       "      <td>4</td>\n",
       "      <td>0.708009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1160</td>\n",
       "      <td>7</td>\n",
       "      <td>0.460284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.6</td>\n",
       "      <td>1044</td>\n",
       "      <td>5</td>\n",
       "      <td>0.302308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.7</td>\n",
       "      <td>847</td>\n",
       "      <td>2</td>\n",
       "      <td>0.230434</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.8</td>\n",
       "      <td>694</td>\n",
       "      <td>1</td>\n",
       "      <td>0.054499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0.9</td>\n",
       "      <td>711</td>\n",
       "      <td>1</td>\n",
       "      <td>0.069085</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      dataset     size  seq identity  count  wrong  wrong % error\n",
       "0   uc30_0.95    32-32           0.0      0      0            NaN\n",
       "1   uc30_0.95    32-32           0.1      0      0            NaN\n",
       "2   uc30_0.95    32-32           0.2     14      0            NaN\n",
       "3   uc30_0.95    32-32           0.3    873     45       0.242345\n",
       "4   uc30_0.95    32-32           0.4   1166     70       0.237401\n",
       "5   uc30_0.95    32-32           0.5    951     39       0.224588\n",
       "6   uc30_0.95    32-32           0.6    923     30       0.242364\n",
       "7   uc30_0.95    32-32           0.7    789     19       0.230704\n",
       "8   uc30_0.95    32-32           0.8    747      9       0.231401\n",
       "9   uc30_0.95    32-32           0.9   1537     18       0.141972\n",
       "10  uc30_0.95   32-256           0.0      0      0            NaN\n",
       "11  uc30_0.95   32-256           0.1      0      0            NaN\n",
       "12  uc30_0.95   32-256           0.2     14      0            NaN\n",
       "13  uc30_0.95   32-256           0.3    873     10       0.022420\n",
       "14  uc30_0.95   32-256           0.4   1166     11       0.064091\n",
       "15  uc30_0.95   32-256           0.5    951      5       0.066788\n",
       "16  uc30_0.95   32-256           0.6    923      9       0.043915\n",
       "17  uc30_0.95   32-256           0.7    789      4       0.023700\n",
       "18  uc30_0.95   32-256           0.8    747      1       0.000634\n",
       "19  uc30_0.95   32-256           0.9   1537      4       0.058178\n",
       "20  uc30_0.95  256-256           0.0      0      0            NaN\n",
       "21  uc30_0.95  256-256           0.1      0      0            NaN\n",
       "22  uc30_0.95  256-256           0.2     14      0            NaN\n",
       "23  uc30_0.95  256-256           0.3    873      1       0.029183\n",
       "24  uc30_0.95  256-256           0.4   1166      2       0.015912\n",
       "25  uc30_0.95  256-256           0.5    951      0            NaN\n",
       "26  uc30_0.95  256-256           0.6    923      1       0.148474\n",
       "27  uc30_0.95  256-256           0.7    789      0            NaN\n",
       "28  uc30_0.95  256-256           0.8    747      0            NaN\n",
       "29  uc30_0.95  256-256           0.9   1537      0            NaN\n",
       "30       uc30    32-32           0.0      0      0            NaN\n",
       "31       uc30    32-32           0.1      0      0            NaN\n",
       "32       uc30    32-32           0.2    192     82       0.927533\n",
       "33       uc30    32-32           0.3   1170    288       0.593890\n",
       "34       uc30    32-32           0.4   1182    272       0.556361\n",
       "35       uc30    32-32           0.5   1160    229       0.533862\n",
       "36       uc30    32-32           0.6   1044    192       0.519658\n",
       "37       uc30    32-32           0.7    847    103       0.495949\n",
       "38       uc30    32-32           0.8    694     86       0.476448\n",
       "39       uc30    32-32           0.9    711     19       0.255545\n",
       "40       uc30   32-256           0.0      0      0            NaN\n",
       "41       uc30   32-256           0.1      0      0            NaN\n",
       "42       uc30   32-256           0.2    192     12       0.142272\n",
       "43       uc30   32-256           0.3   1170     49       0.124958\n",
       "44       uc30   32-256           0.4   1182     49       0.121131\n",
       "45       uc30   32-256           0.5   1160     35       0.155504\n",
       "46       uc30   32-256           0.6   1044     32       0.119739\n",
       "47       uc30   32-256           0.7    847     18       0.069970\n",
       "48       uc30   32-256           0.8    694     21       0.086326\n",
       "49       uc30   32-256           0.9    711      8       0.045885\n",
       "50       uc30  256-256           0.0      0      0            NaN\n",
       "51       uc30  256-256           0.1      0      0            NaN\n",
       "52       uc30  256-256           0.2    192      0            NaN\n",
       "53       uc30  256-256           0.3   1170      7       0.383546\n",
       "54       uc30  256-256           0.4   1182      4       0.708009\n",
       "55       uc30  256-256           0.5   1160      7       0.460284\n",
       "56       uc30  256-256           0.6   1044      5       0.302308\n",
       "57       uc30  256-256           0.7    847      2       0.230434\n",
       "58       uc30  256-256           0.8    694      1       0.054499\n",
       "59       uc30  256-256           0.9    711      1       0.069085"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = csv_to_pandas(output)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:08.989655Z",
     "iopub.status.busy": "2023-02-27T11:54:08.988673Z",
     "iopub.status.idle": "2023-02-27T11:54:08.992042Z",
     "shell.execute_reply": "2023-02-27T11:54:08.992446Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>size</th>\n",
       "      <th>seq identity</th>\n",
       "      <th>count</th>\n",
       "      <th>wrong</th>\n",
       "      <th>wrong % error</th>\n",
       "      <th>error rate</th>\n",
       "      <th>% error</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>873</td>\n",
       "      <td>45</td>\n",
       "      <td>0.242345</td>\n",
       "      <td>0.051546</td>\n",
       "      <td>0.242345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1166</td>\n",
       "      <td>70</td>\n",
       "      <td>0.237401</td>\n",
       "      <td>0.060034</td>\n",
       "      <td>0.237401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>951</td>\n",
       "      <td>39</td>\n",
       "      <td>0.224588</td>\n",
       "      <td>0.041009</td>\n",
       "      <td>0.224588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>923</td>\n",
       "      <td>30</td>\n",
       "      <td>0.242364</td>\n",
       "      <td>0.032503</td>\n",
       "      <td>0.242364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>789</td>\n",
       "      <td>19</td>\n",
       "      <td>0.230704</td>\n",
       "      <td>0.024081</td>\n",
       "      <td>0.230704</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>747</td>\n",
       "      <td>9</td>\n",
       "      <td>0.231401</td>\n",
       "      <td>0.012048</td>\n",
       "      <td>0.231401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>1537</td>\n",
       "      <td>18</td>\n",
       "      <td>0.141972</td>\n",
       "      <td>0.011711</td>\n",
       "      <td>0.141972</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>873</td>\n",
       "      <td>10</td>\n",
       "      <td>0.022420</td>\n",
       "      <td>0.011455</td>\n",
       "      <td>0.022420</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1166</td>\n",
       "      <td>11</td>\n",
       "      <td>0.064091</td>\n",
       "      <td>0.009434</td>\n",
       "      <td>0.064091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>951</td>\n",
       "      <td>5</td>\n",
       "      <td>0.066788</td>\n",
       "      <td>0.005258</td>\n",
       "      <td>0.066788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>923</td>\n",
       "      <td>9</td>\n",
       "      <td>0.043915</td>\n",
       "      <td>0.009751</td>\n",
       "      <td>0.043915</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>789</td>\n",
       "      <td>4</td>\n",
       "      <td>0.023700</td>\n",
       "      <td>0.005070</td>\n",
       "      <td>0.023700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>747</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000634</td>\n",
       "      <td>0.001339</td>\n",
       "      <td>0.000634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>1537</td>\n",
       "      <td>4</td>\n",
       "      <td>0.058178</td>\n",
       "      <td>0.002602</td>\n",
       "      <td>0.058178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>873</td>\n",
       "      <td>1</td>\n",
       "      <td>0.029183</td>\n",
       "      <td>0.001145</td>\n",
       "      <td>0.029183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1166</td>\n",
       "      <td>2</td>\n",
       "      <td>0.015912</td>\n",
       "      <td>0.001715</td>\n",
       "      <td>0.015912</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>951</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>923</td>\n",
       "      <td>1</td>\n",
       "      <td>0.148474</td>\n",
       "      <td>0.001083</td>\n",
       "      <td>0.148474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>789</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>747</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>1537</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>192</td>\n",
       "      <td>82</td>\n",
       "      <td>0.927533</td>\n",
       "      <td>0.427083</td>\n",
       "      <td>0.927533</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>1170</td>\n",
       "      <td>288</td>\n",
       "      <td>0.593890</td>\n",
       "      <td>0.246154</td>\n",
       "      <td>0.593890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1182</td>\n",
       "      <td>272</td>\n",
       "      <td>0.556361</td>\n",
       "      <td>0.230118</td>\n",
       "      <td>0.556361</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>1160</td>\n",
       "      <td>229</td>\n",
       "      <td>0.533862</td>\n",
       "      <td>0.197414</td>\n",
       "      <td>0.533862</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>1044</td>\n",
       "      <td>192</td>\n",
       "      <td>0.519658</td>\n",
       "      <td>0.183908</td>\n",
       "      <td>0.519658</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>847</td>\n",
       "      <td>103</td>\n",
       "      <td>0.495949</td>\n",
       "      <td>0.121606</td>\n",
       "      <td>0.495949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>694</td>\n",
       "      <td>86</td>\n",
       "      <td>0.476448</td>\n",
       "      <td>0.123919</td>\n",
       "      <td>0.476448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>711</td>\n",
       "      <td>19</td>\n",
       "      <td>0.255545</td>\n",
       "      <td>0.026723</td>\n",
       "      <td>0.255545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>192</td>\n",
       "      <td>12</td>\n",
       "      <td>0.142272</td>\n",
       "      <td>0.062500</td>\n",
       "      <td>0.142272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>1170</td>\n",
       "      <td>49</td>\n",
       "      <td>0.124958</td>\n",
       "      <td>0.041880</td>\n",
       "      <td>0.124958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1182</td>\n",
       "      <td>49</td>\n",
       "      <td>0.121131</td>\n",
       "      <td>0.041455</td>\n",
       "      <td>0.121131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>1160</td>\n",
       "      <td>35</td>\n",
       "      <td>0.155504</td>\n",
       "      <td>0.030172</td>\n",
       "      <td>0.155504</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>1044</td>\n",
       "      <td>32</td>\n",
       "      <td>0.119739</td>\n",
       "      <td>0.030651</td>\n",
       "      <td>0.119739</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>847</td>\n",
       "      <td>18</td>\n",
       "      <td>0.069970</td>\n",
       "      <td>0.021251</td>\n",
       "      <td>0.069970</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>694</td>\n",
       "      <td>21</td>\n",
       "      <td>0.086326</td>\n",
       "      <td>0.030259</td>\n",
       "      <td>0.086326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>711</td>\n",
       "      <td>8</td>\n",
       "      <td>0.045885</td>\n",
       "      <td>0.011252</td>\n",
       "      <td>0.045885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>0-10%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>10-20%</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>20-30%</td>\n",
       "      <td>192</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>30-40%</td>\n",
       "      <td>1170</td>\n",
       "      <td>7</td>\n",
       "      <td>0.383546</td>\n",
       "      <td>0.005983</td>\n",
       "      <td>0.383546</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>40-50%</td>\n",
       "      <td>1182</td>\n",
       "      <td>4</td>\n",
       "      <td>0.708009</td>\n",
       "      <td>0.003384</td>\n",
       "      <td>0.708009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>50-60%</td>\n",
       "      <td>1160</td>\n",
       "      <td>7</td>\n",
       "      <td>0.460284</td>\n",
       "      <td>0.006034</td>\n",
       "      <td>0.460284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>60-70%</td>\n",
       "      <td>1044</td>\n",
       "      <td>5</td>\n",
       "      <td>0.302308</td>\n",
       "      <td>0.004789</td>\n",
       "      <td>0.302308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>70-80%</td>\n",
       "      <td>847</td>\n",
       "      <td>2</td>\n",
       "      <td>0.230434</td>\n",
       "      <td>0.002361</td>\n",
       "      <td>0.230434</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>80-90%</td>\n",
       "      <td>694</td>\n",
       "      <td>1</td>\n",
       "      <td>0.054499</td>\n",
       "      <td>0.001441</td>\n",
       "      <td>0.054499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>90-100%</td>\n",
       "      <td>711</td>\n",
       "      <td>1</td>\n",
       "      <td>0.069085</td>\n",
       "      <td>0.001406</td>\n",
       "      <td>0.069085</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      dataset     size seq identity  count  wrong  wrong % error  error rate  \\\n",
       "0   uc30_0.95    32-32        0-10%      0      0            NaN         NaN   \n",
       "1   uc30_0.95    32-32       10-20%      0      0            NaN         NaN   \n",
       "2   uc30_0.95    32-32       20-30%     14      0            NaN    0.000000   \n",
       "3   uc30_0.95    32-32       30-40%    873     45       0.242345    0.051546   \n",
       "4   uc30_0.95    32-32       40-50%   1166     70       0.237401    0.060034   \n",
       "5   uc30_0.95    32-32       50-60%    951     39       0.224588    0.041009   \n",
       "6   uc30_0.95    32-32       60-70%    923     30       0.242364    0.032503   \n",
       "7   uc30_0.95    32-32       70-80%    789     19       0.230704    0.024081   \n",
       "8   uc30_0.95    32-32       80-90%    747      9       0.231401    0.012048   \n",
       "9   uc30_0.95    32-32      90-100%   1537     18       0.141972    0.011711   \n",
       "10  uc30_0.95   32-256        0-10%      0      0            NaN         NaN   \n",
       "11  uc30_0.95   32-256       10-20%      0      0            NaN         NaN   \n",
       "12  uc30_0.95   32-256       20-30%     14      0            NaN    0.000000   \n",
       "13  uc30_0.95   32-256       30-40%    873     10       0.022420    0.011455   \n",
       "14  uc30_0.95   32-256       40-50%   1166     11       0.064091    0.009434   \n",
       "15  uc30_0.95   32-256       50-60%    951      5       0.066788    0.005258   \n",
       "16  uc30_0.95   32-256       60-70%    923      9       0.043915    0.009751   \n",
       "17  uc30_0.95   32-256       70-80%    789      4       0.023700    0.005070   \n",
       "18  uc30_0.95   32-256       80-90%    747      1       0.000634    0.001339   \n",
       "19  uc30_0.95   32-256      90-100%   1537      4       0.058178    0.002602   \n",
       "20  uc30_0.95  256-256        0-10%      0      0            NaN         NaN   \n",
       "21  uc30_0.95  256-256       10-20%      0      0            NaN         NaN   \n",
       "22  uc30_0.95  256-256       20-30%     14      0            NaN    0.000000   \n",
       "23  uc30_0.95  256-256       30-40%    873      1       0.029183    0.001145   \n",
       "24  uc30_0.95  256-256       40-50%   1166      2       0.015912    0.001715   \n",
       "25  uc30_0.95  256-256       50-60%    951      0            NaN    0.000000   \n",
       "26  uc30_0.95  256-256       60-70%    923      1       0.148474    0.001083   \n",
       "27  uc30_0.95  256-256       70-80%    789      0            NaN    0.000000   \n",
       "28  uc30_0.95  256-256       80-90%    747      0            NaN    0.000000   \n",
       "29  uc30_0.95  256-256      90-100%   1537      0            NaN    0.000000   \n",
       "30       uc30    32-32        0-10%      0      0            NaN         NaN   \n",
       "31       uc30    32-32       10-20%      0      0            NaN         NaN   \n",
       "32       uc30    32-32       20-30%    192     82       0.927533    0.427083   \n",
       "33       uc30    32-32       30-40%   1170    288       0.593890    0.246154   \n",
       "34       uc30    32-32       40-50%   1182    272       0.556361    0.230118   \n",
       "35       uc30    32-32       50-60%   1160    229       0.533862    0.197414   \n",
       "36       uc30    32-32       60-70%   1044    192       0.519658    0.183908   \n",
       "37       uc30    32-32       70-80%    847    103       0.495949    0.121606   \n",
       "38       uc30    32-32       80-90%    694     86       0.476448    0.123919   \n",
       "39       uc30    32-32      90-100%    711     19       0.255545    0.026723   \n",
       "40       uc30   32-256        0-10%      0      0            NaN         NaN   \n",
       "41       uc30   32-256       10-20%      0      0            NaN         NaN   \n",
       "42       uc30   32-256       20-30%    192     12       0.142272    0.062500   \n",
       "43       uc30   32-256       30-40%   1170     49       0.124958    0.041880   \n",
       "44       uc30   32-256       40-50%   1182     49       0.121131    0.041455   \n",
       "45       uc30   32-256       50-60%   1160     35       0.155504    0.030172   \n",
       "46       uc30   32-256       60-70%   1044     32       0.119739    0.030651   \n",
       "47       uc30   32-256       70-80%    847     18       0.069970    0.021251   \n",
       "48       uc30   32-256       80-90%    694     21       0.086326    0.030259   \n",
       "49       uc30   32-256      90-100%    711      8       0.045885    0.011252   \n",
       "50       uc30  256-256        0-10%      0      0            NaN         NaN   \n",
       "51       uc30  256-256       10-20%      0      0            NaN         NaN   \n",
       "52       uc30  256-256       20-30%    192      0            NaN    0.000000   \n",
       "53       uc30  256-256       30-40%   1170      7       0.383546    0.005983   \n",
       "54       uc30  256-256       40-50%   1182      4       0.708009    0.003384   \n",
       "55       uc30  256-256       50-60%   1160      7       0.460284    0.006034   \n",
       "56       uc30  256-256       60-70%   1044      5       0.302308    0.004789   \n",
       "57       uc30  256-256       70-80%    847      2       0.230434    0.002361   \n",
       "58       uc30  256-256       80-90%    694      1       0.054499    0.001441   \n",
       "59       uc30  256-256      90-100%    711      1       0.069085    0.001406   \n",
       "\n",
       "     % error  \n",
       "0        NaN  \n",
       "1        NaN  \n",
       "2        NaN  \n",
       "3   0.242345  \n",
       "4   0.237401  \n",
       "5   0.224588  \n",
       "6   0.242364  \n",
       "7   0.230704  \n",
       "8   0.231401  \n",
       "9   0.141972  \n",
       "10       NaN  \n",
       "11       NaN  \n",
       "12       NaN  \n",
       "13  0.022420  \n",
       "14  0.064091  \n",
       "15  0.066788  \n",
       "16  0.043915  \n",
       "17  0.023700  \n",
       "18  0.000634  \n",
       "19  0.058178  \n",
       "20       NaN  \n",
       "21       NaN  \n",
       "22       NaN  \n",
       "23  0.029183  \n",
       "24  0.015912  \n",
       "25       NaN  \n",
       "26  0.148474  \n",
       "27       NaN  \n",
       "28       NaN  \n",
       "29       NaN  \n",
       "30       NaN  \n",
       "31       NaN  \n",
       "32  0.927533  \n",
       "33  0.593890  \n",
       "34  0.556361  \n",
       "35  0.533862  \n",
       "36  0.519658  \n",
       "37  0.495949  \n",
       "38  0.476448  \n",
       "39  0.255545  \n",
       "40       NaN  \n",
       "41       NaN  \n",
       "42  0.142272  \n",
       "43  0.124958  \n",
       "44  0.121131  \n",
       "45  0.155504  \n",
       "46  0.119739  \n",
       "47  0.069970  \n",
       "48  0.086326  \n",
       "49  0.045885  \n",
       "50       NaN  \n",
       "51       NaN  \n",
       "52       NaN  \n",
       "53  0.383546  \n",
       "54  0.708009  \n",
       "55  0.460284  \n",
       "56  0.302308  \n",
       "57  0.230434  \n",
       "58  0.054499  \n",
       "59  0.069085  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[\"error rate\"] = data[\"wrong\"] / data[\"count\"]\n",
    "data[\"% error\"] = data[\"wrong % error\"]\n",
    "data[\"seq identity\"] = data[\"seq identity\"].map({\n",
    "    0.0: \"0-10%\",\n",
    "    0.1: \"10-20%\",\n",
    "    0.2: \"20-30%\",\n",
    "    0.3: \"30-40%\",\n",
    "    0.4: \"40-50%\",\n",
    "    0.5: \"50-60%\",\n",
    "    0.6: \"60-70%\",\n",
    "    0.7: \"70-80%\",\n",
    "    0.8: \"80-90%\",\n",
    "    0.9: \"90-100%\"\n",
    "})\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uniclust30 Error Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:09.008690Z",
     "iopub.status.busy": "2023-02-27T11:54:09.008290Z",
     "iopub.status.idle": "2023-02-27T11:54:09.822090Z",
     "shell.execute_reply": "2023-02-27T11:54:09.822642Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-3737de8302b5487499d721f3a3832c57\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-3737de8302b5487499d721f3a3832c57\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-3737de8302b5487499d721f3a3832c57\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/ea480efd948954613e1bd8b7e4bde828.json\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"size\", \"legend\": null, \"sort\": [\"32-32\", \"32-256\", \"256-256\"]}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"row\": {\"type\": \"nominal\", \"field\": \"dataset\"}, \"x\": {\"type\": \"nominal\", \"field\": \"seq identity\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"error rate\"}}, \"height\": 100, \"width\": 100, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_bar().encode(\n",
    "    x = \"seq identity\",\n",
    "    y = alt.Y(\"error rate\", axis = alt.Axis(format = \"%\")),\n",
    "    column = alt.Column(\"size\", title = \"block size\", sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    row = \"dataset\",\n",
    "    color = alt.Color(\"size\", legend = None, sort = [\"32-32\", \"32-256\", \"256-256\"])\n",
    ").properties(\n",
    "    width = 100,\n",
    "    height = 100\n",
    ")\n",
    "save(c, \"uniclust30_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uniclust30 % Error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:09.839594Z",
     "iopub.status.busy": "2023-02-27T11:54:09.839161Z",
     "iopub.status.idle": "2023-02-27T11:54:10.612319Z",
     "shell.execute_reply": "2023-02-27T11:54:10.612881Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-4e1d1b51f5524a689c12baf0a9a6d819\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-4e1d1b51f5524a689c12baf0a9a6d819\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-4e1d1b51f5524a689c12baf0a9a6d819\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/ea480efd948954613e1bd8b7e4bde828.json\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"size\", \"legend\": null, \"sort\": [\"32-32\", \"32-256\", \"256-256\"]}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"row\": {\"type\": \"nominal\", \"field\": \"dataset\"}, \"x\": {\"type\": \"nominal\", \"field\": \"seq identity\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"% error\"}}, \"height\": 100, \"width\": 100, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_bar().encode(\n",
    "    x = \"seq identity\",\n",
    "    y = alt.Y(\"% error\", axis = alt.Axis(format = \"%\")),\n",
    "    column = alt.Column(\"size\", title = \"block size\", sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    row = \"dataset\",\n",
    "    color = alt.Color(\"size\", legend = None, sort = [\"32-32\", \"32-256\", \"256-256\"])\n",
    ").properties(\n",
    "    width = 100,\n",
    "    height = 100\n",
    ")\n",
    "save(c, \"uniclust30_percent_error.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:10.620578Z",
     "iopub.status.busy": "2023-02-27T11:54:10.618326Z",
     "iopub.status.idle": "2023-02-27T11:54:10.628161Z",
     "shell.execute_reply": "2023-02-27T11:54:10.628712Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>size</th>\n",
       "      <th>count</th>\n",
       "      <th>wrong</th>\n",
       "      <th>error rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>7000</td>\n",
       "      <td>27</td>\n",
       "      <td>0.003857</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-256</td>\n",
       "      <td>7000</td>\n",
       "      <td>224</td>\n",
       "      <td>0.032000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>uc30</td>\n",
       "      <td>32-32</td>\n",
       "      <td>7000</td>\n",
       "      <td>1271</td>\n",
       "      <td>0.181571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>256-256</td>\n",
       "      <td>7000</td>\n",
       "      <td>4</td>\n",
       "      <td>0.000571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-256</td>\n",
       "      <td>7000</td>\n",
       "      <td>44</td>\n",
       "      <td>0.006286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>7000</td>\n",
       "      <td>230</td>\n",
       "      <td>0.032857</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     dataset     size  count  wrong  error rate\n",
       "0       uc30  256-256   7000     27    0.003857\n",
       "1       uc30   32-256   7000    224    0.032000\n",
       "2       uc30    32-32   7000   1271    0.181571\n",
       "3  uc30_0.95  256-256   7000      4    0.000571\n",
       "4  uc30_0.95   32-256   7000     44    0.006286\n",
       "5  uc30_0.95    32-32   7000    230    0.032857"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "agg_data = data.copy()\n",
    "agg_data = agg_data.groupby([\"dataset\", \"size\"]).agg({\"count\": \"sum\", \"wrong\": \"sum\"}).reset_index()\n",
    "agg_data[\"error rate\"] = agg_data[\"wrong\"] / agg_data[\"count\"]\n",
    "agg_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Overall Uniclust30 Error Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:10.645309Z",
     "iopub.status.busy": "2023-02-27T11:54:10.644904Z",
     "iopub.status.idle": "2023-02-27T11:54:11.427132Z",
     "shell.execute_reply": "2023-02-27T11:54:11.427534Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-4edad9cf12974c659b73f575f17511e0\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-4edad9cf12974c659b73f575f17511e0\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-4edad9cf12974c659b73f575f17511e0\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/69e677ca653d89a21d2f73da56d9723d.json\"}, \"facet\": {\"column\": {\"type\": \"nominal\", \"field\": \"dataset\", \"header\": {\"orient\": \"bottom\"}}}, \"spec\": {\"layer\": [{\"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"size\", \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"x\": {\"type\": \"nominal\", \"axis\": null, \"field\": \"size\", \"sort\": [\"32-32\", \"32-256\", \"256-256\"]}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"error rate\"}}}, {\"mark\": {\"type\": \"text\", \"dy\": -4, \"size\": 8}, \"encoding\": {\"color\": {\"value\": \"black\"}, \"text\": {\"type\": \"quantitative\", \"field\": \"error rate\", \"format\": \".1%\"}, \"x\": {\"type\": \"nominal\", \"axis\": null, \"field\": \"size\", \"sort\": [\"32-32\", \"32-256\", \"256-256\"]}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"error rate\"}}}], \"height\": 100, \"width\": 50}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.FacetChart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(agg_data).mark_bar().encode(\n",
    "    x = alt.X(\"size\", axis = None, sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    y = alt.Y(\"error rate\", axis = alt.Axis(format = \"%\")),\n",
    "    color = alt.Color(\"size\", title = \"block size\", sort = [\"32-32\", \"32-256\", \"256-256\"])\n",
    ")\n",
    "t = c.mark_text(dy = -4, size = 8).encode(text = alt.Text(\"error rate\", format = \".1%\"), color = alt.value(\"black\"))\n",
    "c = (c + t).properties(\n",
    "    width = 50,\n",
    "    height = 100\n",
    ").facet(\n",
    "    column = alt.Column(\"dataset\", header = alt.Header(orient = \"bottom\")),\n",
    ")\n",
    "save(c, \"uniclust30_overall_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:11.430676Z",
     "iopub.status.busy": "2023-02-27T11:54:11.430292Z",
     "iopub.status.idle": "2023-02-27T11:54:11.752562Z",
     "shell.execute_reply": "2023-02-27T11:54:11.753061Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>size</th>\n",
       "      <th>query len</th>\n",
       "      <th>reference len</th>\n",
       "      <th>seq id</th>\n",
       "      <th>pred score</th>\n",
       "      <th>true score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>1944</td>\n",
       "      <td>1871</td>\n",
       "      <td>0.362095</td>\n",
       "      <td>1656</td>\n",
       "      <td>2909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>804</td>\n",
       "      <td>808</td>\n",
       "      <td>0.363745</td>\n",
       "      <td>1184</td>\n",
       "      <td>1184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>4242</td>\n",
       "      <td>4122</td>\n",
       "      <td>0.427032</td>\n",
       "      <td>6722</td>\n",
       "      <td>7639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>230</td>\n",
       "      <td>232</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>405</td>\n",
       "      <td>405</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>264</td>\n",
       "      <td>259</td>\n",
       "      <td>0.324528</td>\n",
       "      <td>390</td>\n",
       "      <td>390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41995</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>542</td>\n",
       "      <td>542</td>\n",
       "      <td>0.996310</td>\n",
       "      <td>2862</td>\n",
       "      <td>2862</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41996</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>277</td>\n",
       "      <td>303</td>\n",
       "      <td>0.762376</td>\n",
       "      <td>1103</td>\n",
       "      <td>1103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41997</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>65</td>\n",
       "      <td>65</td>\n",
       "      <td>0.907692</td>\n",
       "      <td>307</td>\n",
       "      <td>307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41998</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>45</td>\n",
       "      <td>56</td>\n",
       "      <td>0.732143</td>\n",
       "      <td>195</td>\n",
       "      <td>195</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41999</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>126</td>\n",
       "      <td>139</td>\n",
       "      <td>0.856115</td>\n",
       "      <td>587</td>\n",
       "      <td>587</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>42000 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         dataset     size  query len  reference len    seq id  pred score  \\\n",
       "0      uc30_0.95    32-32       1944           1871  0.362095        1656   \n",
       "1      uc30_0.95    32-32        804            808  0.363745        1184   \n",
       "2      uc30_0.95    32-32       4242           4122  0.427032        6722   \n",
       "3      uc30_0.95    32-32        230            232  0.400000         405   \n",
       "4      uc30_0.95    32-32        264            259  0.324528         390   \n",
       "...          ...      ...        ...            ...       ...         ...   \n",
       "41995       uc30  256-256        542            542  0.996310        2862   \n",
       "41996       uc30  256-256        277            303  0.762376        1103   \n",
       "41997       uc30  256-256         65             65  0.907692         307   \n",
       "41998       uc30  256-256         45             56  0.732143         195   \n",
       "41999       uc30  256-256        126            139  0.856115         587   \n",
       "\n",
       "       true score  \n",
       "0            2909  \n",
       "1            1184  \n",
       "2            7639  \n",
       "3             405  \n",
       "4             390  \n",
       "...           ...  \n",
       "41995        2862  \n",
       "41996        1103  \n",
       "41997         307  \n",
       "41998         195  \n",
       "41999         587  \n",
       "\n",
       "[42000 rows x 7 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = file_to_pandas(\"../data/uc_accuracy.csv\")\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uniclust30 Our Score vs True Score (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:11.763198Z",
     "iopub.status.busy": "2023-02-27T11:54:11.762734Z",
     "iopub.status.idle": "2023-02-27T11:54:12.790422Z",
     "shell.execute_reply": "2023-02-27T11:54:12.790869Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-fca012c7e1854bd1a7ef9f35e6237904\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-fca012c7e1854bd1a7ef9f35e6237904\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-fca012c7e1854bd1a7ef9f35e6237904\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/1c0b34f2db38b68f8b0b27a0545f67a4.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"header\": {\"orient\": \"bottom\"}, \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"row\": {\"type\": \"nominal\", \"field\": \"dataset\"}, \"x\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"true score\"}, \"y\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"pred score\"}}, \"height\": 200, \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"true score\", bin = alt.Bin(maxbins = 50)),\n",
    "    y = alt.Y(\"pred score\", bin = alt.Bin(maxbins = 50)),\n",
    "    row = \"dataset\",\n",
    "    column = alt.Column(\"size\", title = \"block size\", header = alt.Header(orient = \"bottom\"), sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"uniclust30_scores.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:12.794839Z",
     "iopub.status.busy": "2023-02-27T11:54:12.794418Z",
     "iopub.status.idle": "2023-02-27T11:54:12.809235Z",
     "shell.execute_reply": "2023-02-27T11:54:12.809640Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>size</th>\n",
       "      <th>query len</th>\n",
       "      <th>reference len</th>\n",
       "      <th>seq id</th>\n",
       "      <th>pred score</th>\n",
       "      <th>true score</th>\n",
       "      <th>seq length</th>\n",
       "      <th>% error</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>1944</td>\n",
       "      <td>1871</td>\n",
       "      <td>0.362095</td>\n",
       "      <td>1656</td>\n",
       "      <td>2909</td>\n",
       "      <td>1944</td>\n",
       "      <td>0.430732</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>804</td>\n",
       "      <td>808</td>\n",
       "      <td>0.363745</td>\n",
       "      <td>1184</td>\n",
       "      <td>1184</td>\n",
       "      <td>808</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>4242</td>\n",
       "      <td>4122</td>\n",
       "      <td>0.427032</td>\n",
       "      <td>6722</td>\n",
       "      <td>7639</td>\n",
       "      <td>4242</td>\n",
       "      <td>0.120042</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>230</td>\n",
       "      <td>232</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>405</td>\n",
       "      <td>405</td>\n",
       "      <td>232</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>uc30_0.95</td>\n",
       "      <td>32-32</td>\n",
       "      <td>264</td>\n",
       "      <td>259</td>\n",
       "      <td>0.324528</td>\n",
       "      <td>390</td>\n",
       "      <td>390</td>\n",
       "      <td>264</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41995</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>542</td>\n",
       "      <td>542</td>\n",
       "      <td>0.996310</td>\n",
       "      <td>2862</td>\n",
       "      <td>2862</td>\n",
       "      <td>542</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41996</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>277</td>\n",
       "      <td>303</td>\n",
       "      <td>0.762376</td>\n",
       "      <td>1103</td>\n",
       "      <td>1103</td>\n",
       "      <td>303</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41997</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>65</td>\n",
       "      <td>65</td>\n",
       "      <td>0.907692</td>\n",
       "      <td>307</td>\n",
       "      <td>307</td>\n",
       "      <td>65</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41998</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>45</td>\n",
       "      <td>56</td>\n",
       "      <td>0.732143</td>\n",
       "      <td>195</td>\n",
       "      <td>195</td>\n",
       "      <td>56</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41999</th>\n",
       "      <td>uc30</td>\n",
       "      <td>256-256</td>\n",
       "      <td>126</td>\n",
       "      <td>139</td>\n",
       "      <td>0.856115</td>\n",
       "      <td>587</td>\n",
       "      <td>587</td>\n",
       "      <td>139</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>42000 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         dataset     size  query len  reference len    seq id  pred score  \\\n",
       "0      uc30_0.95    32-32       1944           1871  0.362095        1656   \n",
       "1      uc30_0.95    32-32        804            808  0.363745        1184   \n",
       "2      uc30_0.95    32-32       4242           4122  0.427032        6722   \n",
       "3      uc30_0.95    32-32        230            232  0.400000         405   \n",
       "4      uc30_0.95    32-32        264            259  0.324528         390   \n",
       "...          ...      ...        ...            ...       ...         ...   \n",
       "41995       uc30  256-256        542            542  0.996310        2862   \n",
       "41996       uc30  256-256        277            303  0.762376        1103   \n",
       "41997       uc30  256-256         65             65  0.907692         307   \n",
       "41998       uc30  256-256         45             56  0.732143         195   \n",
       "41999       uc30  256-256        126            139  0.856115         587   \n",
       "\n",
       "       true score  seq length   % error  \n",
       "0            2909        1944  0.430732  \n",
       "1            1184         808  0.000000  \n",
       "2            7639        4242  0.120042  \n",
       "3             405         232  0.000000  \n",
       "4             390         264  0.000000  \n",
       "...           ...         ...       ...  \n",
       "41995        2862         542  0.000000  \n",
       "41996        1103         303  0.000000  \n",
       "41997         307          65  0.000000  \n",
       "41998         195          56  0.000000  \n",
       "41999         587         139  0.000000  \n",
       "\n",
       "[42000 rows x 9 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[\"seq length\"] = data[[\"query len\", \"reference len\"]].max(axis = 1)\n",
    "data[\"% error\"] = 1.0 - data[\"pred score\"] / data[\"true score\"]\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uniclust30 Sequence Length vs % Error (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:12.816939Z",
     "iopub.status.busy": "2023-02-27T11:54:12.816504Z",
     "iopub.status.idle": "2023-02-27T11:54:13.847531Z",
     "shell.execute_reply": "2023-02-27T11:54:13.847993Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-2dfe6b3f1bcf4d47aaa3cebf0afaa789\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-2dfe6b3f1bcf4d47aaa3cebf0afaa789\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-2dfe6b3f1bcf4d47aaa3cebf0afaa789\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/c9377a24f524708e6a09f9dcad94e877.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"header\": {\"orient\": \"bottom\"}, \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"x\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"seq length\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"bin\": {\"maxbins\": 50}, \"field\": \"% error\"}}, \"height\": 200, \"transform\": [{\"filter\": \"((datum.dataset === 'uc30_0.95') && (datum.size !== '256-256'))\"}], \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"seq length\", bin = alt.Bin(maxbins = 50)),\n",
    "    y = alt.Y(\"% error\", bin = alt.Bin(maxbins = 50), axis = alt.Axis(format = \"%\")),\n",
    "    column = alt.Column(\"size\", title = \"block size\", header = alt.Header(orient = \"bottom\"), sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").transform_filter(\n",
    "    (datum.dataset == \"uc30_0.95\") & (datum.size != \"256-256\")\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"uniclust30_length_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uniclust30 Sequence Identity vs % Error (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:13.856152Z",
     "iopub.status.busy": "2023-02-27T11:54:13.855642Z",
     "iopub.status.idle": "2023-02-27T11:54:14.884615Z",
     "shell.execute_reply": "2023-02-27T11:54:14.885025Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-eac886b38e1e46069a29bb4c2df92060\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-eac886b38e1e46069a29bb4c2df92060\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-eac886b38e1e46069a29bb4c2df92060\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/c9377a24f524708e6a09f9dcad94e877.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"header\": {\"orient\": \"bottom\"}, \"sort\": [\"32-32\", \"32-256\", \"256-256\"], \"title\": \"block size\"}, \"x\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"bin\": {\"maxbins\": 50}, \"field\": \"seq id\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"bin\": {\"maxbins\": 50}, \"field\": \"% error\"}}, \"height\": 200, \"transform\": [{\"filter\": \"((datum.dataset === 'uc30_0.95') && (datum.size !== '256-256'))\"}], \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"seq id\", bin = alt.Bin(maxbins = 50), axis = alt.Axis(format = \"%\")),\n",
    "    y = alt.Y(\"% error\", bin = alt.Bin(maxbins = 50), axis = alt.Axis(format = \"%\")),\n",
    "    column = alt.Column(\"size\", title = \"block size\", header = alt.Header(orient = \"bottom\"), sort = [\"32-32\", \"32-256\", \"256-256\"]),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").transform_filter(\n",
    "    (datum.dataset == \"uc30_0.95\") & (datum.size != \"256-256\")\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"uniclust30_seq_id_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DNA Reads Global Alignment"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T11:54:14.888370Z",
     "iopub.status.busy": "2023-02-27T11:54:14.887957Z",
     "iopub.status.idle": "2023-02-27T12:19:50.164258Z",
     "shell.execute_reply": "2023-02-27T12:19:50.164759Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['',\n",
       " 'dataset, total, wrong, wrong % error, min size wrong, wfa wrong',\n",
       " '',\n",
       " 'illumina, 100000, 0, NaN, 0, 0',\n",
       " '# illumina seq id avg: 0.997052517030022',\n",
       " '',\n",
       " 'nanopore 1kbp, 12477, 21, 0.060149406709727474, 1810, 21',\n",
       " '# nanopore 1kbp seq id avg: 0.8926079817605514',\n",
       " '',\n",
       " 'nanopore <10kbp, 5000, 109, 0.035888133253518265, 1595, 645',\n",
       " '# nanopore <10kbp seq id avg: 0.8752513435635519',\n",
       " '',\n",
       " 'nanopore <50kbp, 10000, 278, 0.020799640807527112, 2599, 2545',\n",
       " '# nanopore <50kbp seq id avg: 0.8795798677370729',\n",
       " '# Done!']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd .. && cargo run --example nanopore_accuracy --release --features simd_avx2 --quiet\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:50.168669Z",
     "iopub.status.busy": "2023-02-27T12:19:50.168197Z",
     "iopub.status.idle": "2023-02-27T12:19:50.176876Z",
     "shell.execute_reply": "2023-02-27T12:19:50.177370Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>total</th>\n",
       "      <th>wrong</th>\n",
       "      <th>wrong % error</th>\n",
       "      <th>min size wrong</th>\n",
       "      <th>wfa wrong</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>illumina</td>\n",
       "      <td>100000</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>nanopore 1kbp</td>\n",
       "      <td>12477</td>\n",
       "      <td>21</td>\n",
       "      <td>0.060149</td>\n",
       "      <td>1810</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>nanopore &lt;10kbp</td>\n",
       "      <td>5000</td>\n",
       "      <td>109</td>\n",
       "      <td>0.035888</td>\n",
       "      <td>1595</td>\n",
       "      <td>645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>10000</td>\n",
       "      <td>278</td>\n",
       "      <td>0.020800</td>\n",
       "      <td>2599</td>\n",
       "      <td>2545</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           dataset   total  wrong  wrong % error  min size wrong  wfa wrong\n",
       "0         illumina  100000      0            NaN               0          0\n",
       "1    nanopore 1kbp   12477     21       0.060149            1810         21\n",
       "2  nanopore <10kbp    5000    109       0.035888            1595        645\n",
       "3  nanopore <50kbp   10000    278       0.020800            2599       2545"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = csv_to_pandas(output)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:50.182739Z",
     "iopub.status.busy": "2023-02-27T12:19:50.182241Z",
     "iopub.status.idle": "2023-02-27T12:19:50.187837Z",
     "shell.execute_reply": "2023-02-27T12:19:50.188846Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "           dataset   reads  errors error rate % error\n",
      "0         illumina  100000       0       0.0%    0.0%\n",
      "1    nanopore 1kbp   12477      21       0.2%    6.0%\n",
      "2  nanopore <10kbp    5000     109       2.2%    3.6%\n",
      "3  nanopore <50kbp   10000     278       2.8%    2.1%\n"
     ]
    }
   ],
   "source": [
    "data[\"error rate\"] = data[\"wrong\"] / data[\"total\"]\n",
    "data = data.rename(columns = {\"total\": \"reads\", \"wrong\": \"errors\", \"wrong % error\": \"% error\"})\n",
    "data = data[[\"dataset\", \"reads\", \"errors\", \"error rate\", \"% error\"]]\n",
    "data = data.fillna(0)\n",
    "data[\"error rate\"] = data[\"error rate\"].map(\"{:.1%}\".format)\n",
    "data[\"% error\"] = data[\"% error\"].map(\"{:.1%}\".format)\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:50.191761Z",
     "iopub.status.busy": "2023-02-27T12:19:50.191287Z",
     "iopub.status.idle": "2023-02-27T12:19:51.058341Z",
     "shell.execute_reply": "2023-02-27T12:19:51.058898Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dataset</th>\n",
       "      <th>query len</th>\n",
       "      <th>reference len</th>\n",
       "      <th>pred score</th>\n",
       "      <th>true score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>illumina</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>190</td>\n",
       "      <td>190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>illumina</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>196</td>\n",
       "      <td>196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>illumina</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>196</td>\n",
       "      <td>196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>illumina</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>196</td>\n",
       "      <td>196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>illumina</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>196</td>\n",
       "      <td>196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127472</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>1235</td>\n",
       "      <td>1291</td>\n",
       "      <td>1904</td>\n",
       "      <td>1904</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127473</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>15970</td>\n",
       "      <td>16244</td>\n",
       "      <td>24994</td>\n",
       "      <td>24994</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127474</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>3784</td>\n",
       "      <td>3843</td>\n",
       "      <td>6290</td>\n",
       "      <td>6290</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127475</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>881</td>\n",
       "      <td>975</td>\n",
       "      <td>1428</td>\n",
       "      <td>1428</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127476</th>\n",
       "      <td>nanopore &lt;50kbp</td>\n",
       "      <td>3206</td>\n",
       "      <td>2978</td>\n",
       "      <td>3416</td>\n",
       "      <td>3416</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>127477 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                dataset  query len  reference len  pred score  true score\n",
       "0              illumina        101            101         190         190\n",
       "1              illumina        101            101         196         196\n",
       "2              illumina        101            101         196         196\n",
       "3              illumina        101            101         196         196\n",
       "4              illumina        101            101         196         196\n",
       "...                 ...        ...            ...         ...         ...\n",
       "127472  nanopore <50kbp       1235           1291        1904        1904\n",
       "127473  nanopore <50kbp      15970          16244       24994       24994\n",
       "127474  nanopore <50kbp       3784           3843        6290        6290\n",
       "127475  nanopore <50kbp        881            975        1428        1428\n",
       "127476  nanopore <50kbp       3206           2978        3416        3416\n",
       "\n",
       "[127477 rows x 5 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = file_to_pandas(\"../data/nanopore_accuracy.csv\")\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Nanopore <10kbp Global Alignment Our Score vs True Score (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:51.067125Z",
     "iopub.status.busy": "2023-02-27T12:19:51.066631Z",
     "iopub.status.idle": "2023-02-27T12:19:52.302680Z",
     "shell.execute_reply": "2023-02-27T12:19:52.303088Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-67b3afac1a5540a09cf748ad66320616\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-67b3afac1a5540a09cf748ad66320616\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-67b3afac1a5540a09cf748ad66320616\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/af249d1787db322cf7770f65a8e8f792.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"x\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"true score\"}, \"y\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"pred score\"}}, \"height\": 200, \"transform\": [{\"filter\": \"(datum.dataset === 'nanopore <10kbp')\"}], \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"true score\", bin = alt.Bin(maxbins = 50)),\n",
    "    y = alt.Y(\"pred score\", bin = alt.Bin(maxbins = 50)),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").transform_filter(\n",
    "    datum.dataset == \"nanopore <10kbp\"\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"nanopore_10kbp_scores.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Nanopore <50kbp Global Alignment Our Score vs True Score (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:52.309926Z",
     "iopub.status.busy": "2023-02-27T12:19:52.309515Z",
     "iopub.status.idle": "2023-02-27T12:19:53.486732Z",
     "shell.execute_reply": "2023-02-27T12:19:53.487176Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-58046403a3fd4ff0bfac071f176d368b\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-58046403a3fd4ff0bfac071f176d368b\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-58046403a3fd4ff0bfac071f176d368b\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/af249d1787db322cf7770f65a8e8f792.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"x\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"true score\"}, \"y\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"pred score\"}}, \"height\": 200, \"transform\": [{\"filter\": \"(datum.dataset === 'nanopore <50kbp')\"}], \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"true score\", bin = alt.Bin(maxbins = 50)),\n",
    "    y = alt.Y(\"pred score\", bin = alt.Bin(maxbins = 50)),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").transform_filter(\n",
    "    datum.dataset == \"nanopore <50kbp\"\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"nanopore_50kbp_scores.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Nanopore Data Compare Setup\n",
    "\n",
    "To run the comparisons below, you need to clone the following repos, place them in the same directory where this repo (block aligner) is located, and follow their setup instructions:\n",
    "* [diff-bench-paper](https://github.com/Daniel-Liu-c0deb0t/diff-bench-paper)\n",
    "* [adaptivebandbench](https://github.com/Daniel-Liu-c0deb0t/adaptivebandbench)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Nanopore Data Compare"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:19:53.490832Z",
     "iopub.status.busy": "2023-02-27T12:19:53.490359Z",
     "iopub.status.idle": "2023-02-27T12:20:26.228821Z",
     "shell.execute_reply": "2023-02-27T12:20:26.229299Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['scores_l1000.tsv',\n",
       " 'scores_l10000.tsv',\n",
       " 'scores_l25000.tsv',\n",
       " 'scores_default.tsv']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd ../../diff-bench-paper/supplementary_data/benchmark_codes && ./custom_scores.sh 2>&1 | grep '\\.tsv'\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:20:26.233270Z",
     "iopub.status.busy": "2023-02-27T12:20:26.232730Z",
     "iopub.status.idle": "2023-02-27T12:20:26.235018Z",
     "shell.execute_reply": "2023-02-27T12:20:26.235509Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['1000', '10000', '25000', 'default']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lengths = []\n",
    "for f in output:\n",
    "    l = f[len(\"scores_\"):f.index(\".\")]\n",
    "    lengths.append(l[1:] if l[0] == \"l\" else l)\n",
    "lengths"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:20:26.239060Z",
     "iopub.status.busy": "2023-02-27T12:20:26.238591Z",
     "iopub.status.idle": "2023-02-27T12:21:00.433788Z",
     "shell.execute_reply": "2023-02-27T12:21:00.434247Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 21, 0.08564959576734898, 1652, 0.014478023753787836',\n",
       "  '',\n",
       "  '64, 1734, 6, 0.014165306396410624, 1669, 0.017846773911076242',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 123, 0.11277759543387586, 1546, 0.0018081439985594904',\n",
       "  '',\n",
       "  '64, 1734, 56, 0.01591056402384434, 1633, 0.01032615586212946',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 203, 0.1292233687300956, 892, 0.0016197787311747142',\n",
       "  '',\n",
       "  '64, 1734, 75, 0.013415647980847437, 1051, 0.02590382915635615',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 229, 0.1193901258355045, 37, 0.024771049421762822',\n",
       "  '',\n",
       "  '64, 1734, 86, 0.013091483866668505, 176, 0.1557904770879331',\n",
       "  '# Done!']]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path_prefix = \"../diff-bench-paper/\"\n",
    "outputs = []\n",
    "for f in output:\n",
    "    o = !cd .. && cargo run --example compare --release --features simd_avx2 --quiet -- {path_prefix + f} 50\n",
    "    outputs.append(o)\n",
    "outputs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:21:00.438114Z",
     "iopub.status.busy": "2023-02-27T12:21:00.437719Z",
     "iopub.status.idle": "2023-02-27T12:21:00.454295Z",
     "shell.execute_reply": "2023-02-27T12:21:00.454742Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>length</th>\n",
       "      <th>max size</th>\n",
       "      <th>total</th>\n",
       "      <th>other better</th>\n",
       "      <th>other % better</th>\n",
       "      <th>us better</th>\n",
       "      <th>us % better</th>\n",
       "      <th>band width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1000</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>21</td>\n",
       "      <td>0.085650</td>\n",
       "      <td>1652</td>\n",
       "      <td>0.014478</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1000</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>6</td>\n",
       "      <td>0.014165</td>\n",
       "      <td>1669</td>\n",
       "      <td>0.017847</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10000</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>123</td>\n",
       "      <td>0.112778</td>\n",
       "      <td>1546</td>\n",
       "      <td>0.001808</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10000</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>56</td>\n",
       "      <td>0.015911</td>\n",
       "      <td>1633</td>\n",
       "      <td>0.010326</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>25000</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>203</td>\n",
       "      <td>0.129223</td>\n",
       "      <td>892</td>\n",
       "      <td>0.001620</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>25000</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>75</td>\n",
       "      <td>0.013416</td>\n",
       "      <td>1051</td>\n",
       "      <td>0.025904</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>default</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>229</td>\n",
       "      <td>0.119390</td>\n",
       "      <td>37</td>\n",
       "      <td>0.024771</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>default</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>86</td>\n",
       "      <td>0.013091</td>\n",
       "      <td>176</td>\n",
       "      <td>0.155790</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    length  max size  total  other better  other % better  us better  \\\n",
       "0     1000        32   1734            21        0.085650       1652   \n",
       "1     1000        64   1734             6        0.014165       1669   \n",
       "2    10000        32   1734           123        0.112778       1546   \n",
       "3    10000        64   1734            56        0.015911       1633   \n",
       "4    25000        32   1734           203        0.129223        892   \n",
       "5    25000        64   1734            75        0.013416       1051   \n",
       "6  default        32   1734           229        0.119390         37   \n",
       "7  default        64   1734            86        0.013091        176   \n",
       "\n",
       "   us % better  band width  \n",
       "0     0.014478          32  \n",
       "1     0.017847          32  \n",
       "2     0.001808          32  \n",
       "3     0.010326          32  \n",
       "4     0.001620          32  \n",
       "5     0.025904          32  \n",
       "6     0.024771          32  \n",
       "7     0.155790          32  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = []\n",
    "for o in outputs:\n",
    "    d = csv_to_pandas(o)\n",
    "    data.append(d)\n",
    "data = pd.concat(data, keys = lengths)\n",
    "data = data.reset_index()\n",
    "data = data.drop(columns = [\"level_1\"])\n",
    "data = data.rename(columns = {\"level_0\": \"length\"})\n",
    "data[\"band width\"] = 32\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:21:00.457892Z",
     "iopub.status.busy": "2023-02-27T12:21:00.457479Z",
     "iopub.status.idle": "2023-02-27T12:23:13.981031Z",
     "shell.execute_reply": "2023-02-27T12:23:13.981527Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['scores_l1000_b256.tsv',\n",
       " 'scores_l10000_b256.tsv',\n",
       " 'scores_l10000_b2048.tsv',\n",
       " 'scores_b256.tsv',\n",
       " 'scores_b2048.tsv']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd ../../adaptivebandbench && ./custom_scores.sh 2>&1 | grep '\\.tsv'\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:13.985933Z",
     "iopub.status.busy": "2023-02-27T12:23:13.985444Z",
     "iopub.status.idle": "2023-02-27T12:23:13.987563Z",
     "shell.execute_reply": "2023-02-27T12:23:13.988103Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['1000', '10000', '10000', 'default', 'default']\n",
      "['256', '256', '2048', '256', '2048']\n"
     ]
    }
   ],
   "source": [
    "lengths = []\n",
    "band_widths = []\n",
    "for f in output:\n",
    "    l = f[len(\"scores_\"):f.index(\".\")]\n",
    "    if l[0] == \"l\":\n",
    "        lengths.append(l[1:l.index(\"_\")])\n",
    "        l = l[l.index(\"_\") + 1:]\n",
    "    else:\n",
    "        lengths.append(\"default\")\n",
    "    if l[0] == \"b\":\n",
    "        band_widths.append(l[1:])\n",
    "print(lengths)\n",
    "print(band_widths)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:13.991600Z",
     "iopub.status.busy": "2023-02-27T12:23:13.991122Z",
     "iopub.status.idle": "2023-02-27T12:23:56.420915Z",
     "shell.execute_reply": "2023-02-27T12:23:56.421382Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 56, 0.13765090849996714, 0, NaN',\n",
       "  '',\n",
       "  '64, 1734, 28, 0.024168297720724062, 0, NaN',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 134, 0.13674604294825887, 1589, 0.61734014542284',\n",
       "  '',\n",
       "  '64, 1734, 120, 0.04701559488367986, 1606, 0.6220346985685162',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 203, 0.16989582863274405, 0, NaN',\n",
       "  '',\n",
       "  '64, 1734, 145, 0.06028818832879965, 0, NaN',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 135, 0.13540622232038024, 1594, 0.8403591347916828',\n",
       "  '',\n",
       "  '64, 1734, 120, 0.05296844615029002, 1612, 0.848036363148492',\n",
       "  '# Done!'],\n",
       " ['max size, total, other better, other % better, us better, us % better',\n",
       "  '',\n",
       "  '32, 1734, 269, 0.21050607201659027, 379, 0.1479370409142696',\n",
       "  '',\n",
       "  '64, 1734, 168, 0.07369966954145103, 419, 0.15517942649488767',\n",
       "  '# Done!']]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path_prefix = \"../adaptivebandbench/\"\n",
    "outputs = []\n",
    "for f in output:\n",
    "    o = !cd .. && cargo run --example compare --release --features simd_avx2 --quiet -- {path_prefix + f} 100000\n",
    "    outputs.append(o)\n",
    "outputs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.425636Z",
     "iopub.status.busy": "2023-02-27T12:23:56.425072Z",
     "iopub.status.idle": "2023-02-27T12:23:56.448535Z",
     "shell.execute_reply": "2023-02-27T12:23:56.448160Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>length</th>\n",
       "      <th>band width</th>\n",
       "      <th>max size</th>\n",
       "      <th>total</th>\n",
       "      <th>other better</th>\n",
       "      <th>other % better</th>\n",
       "      <th>us better</th>\n",
       "      <th>us % better</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1000</td>\n",
       "      <td>256</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>56</td>\n",
       "      <td>0.137651</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1000</td>\n",
       "      <td>256</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>28</td>\n",
       "      <td>0.024168</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10000</td>\n",
       "      <td>256</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>134</td>\n",
       "      <td>0.136746</td>\n",
       "      <td>1589</td>\n",
       "      <td>0.617340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10000</td>\n",
       "      <td>256</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>120</td>\n",
       "      <td>0.047016</td>\n",
       "      <td>1606</td>\n",
       "      <td>0.622035</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10000</td>\n",
       "      <td>2048</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>203</td>\n",
       "      <td>0.169896</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>10000</td>\n",
       "      <td>2048</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>145</td>\n",
       "      <td>0.060288</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>default</td>\n",
       "      <td>256</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>135</td>\n",
       "      <td>0.135406</td>\n",
       "      <td>1594</td>\n",
       "      <td>0.840359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>default</td>\n",
       "      <td>256</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>120</td>\n",
       "      <td>0.052968</td>\n",
       "      <td>1612</td>\n",
       "      <td>0.848036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>default</td>\n",
       "      <td>2048</td>\n",
       "      <td>32</td>\n",
       "      <td>1734</td>\n",
       "      <td>269</td>\n",
       "      <td>0.210506</td>\n",
       "      <td>379</td>\n",
       "      <td>0.147937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>default</td>\n",
       "      <td>2048</td>\n",
       "      <td>64</td>\n",
       "      <td>1734</td>\n",
       "      <td>168</td>\n",
       "      <td>0.073700</td>\n",
       "      <td>419</td>\n",
       "      <td>0.155179</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    length band width  max size  total  other better  other % better  \\\n",
       "0     1000        256        32   1734            56        0.137651   \n",
       "1     1000        256        64   1734            28        0.024168   \n",
       "2    10000        256        32   1734           134        0.136746   \n",
       "3    10000        256        64   1734           120        0.047016   \n",
       "4    10000       2048        32   1734           203        0.169896   \n",
       "5    10000       2048        64   1734           145        0.060288   \n",
       "6  default        256        32   1734           135        0.135406   \n",
       "7  default        256        64   1734           120        0.052968   \n",
       "8  default       2048        32   1734           269        0.210506   \n",
       "9  default       2048        64   1734           168        0.073700   \n",
       "\n",
       "   us better  us % better  \n",
       "0          0          NaN  \n",
       "1          0          NaN  \n",
       "2       1589     0.617340  \n",
       "3       1606     0.622035  \n",
       "4          0          NaN  \n",
       "5          0          NaN  \n",
       "6       1594     0.840359  \n",
       "7       1612     0.848036  \n",
       "8        379     0.147937  \n",
       "9        419     0.155179  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2 = []\n",
    "for o in outputs:\n",
    "    d = csv_to_pandas(o)\n",
    "    data2.append(d)\n",
    "index = list(zip(lengths, band_widths))\n",
    "data2 = pd.concat(data2, keys = index)\n",
    "data2 = data2.reset_index()\n",
    "data2 = data2.drop(columns = [\"level_2\"])\n",
    "data2 = data2.rename(columns = {\"level_0\": \"length\", \"level_1\": \"band width\"})\n",
    "data2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.453442Z",
     "iopub.status.busy": "2023-02-27T12:23:56.453000Z",
     "iopub.status.idle": "2023-02-27T12:23:56.454610Z",
     "shell.execute_reply": "2023-02-27T12:23:56.455091Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data[\"other better %\"] = data[\"other better\"] / data[\"total\"]\n",
    "data[\"us better %\"] = data[\"us better\"] / data[\"total\"]\n",
    "\n",
    "data2[\"other better %\"] = data2[\"other better\"] / data2[\"total\"]\n",
    "data2[\"us better %\"] = data2[\"us better\"] / data2[\"total\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.459061Z",
     "iopub.status.busy": "2023-02-27T12:23:56.458593Z",
     "iopub.status.idle": "2023-02-27T12:23:56.460325Z",
     "shell.execute_reply": "2023-02-27T12:23:56.460816Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data[\"equal %\"] = 1.0 - data[\"other better %\"] - data[\"us better %\"]\n",
    "data2[\"equal %\"] = 1.0 - data2[\"other better %\"] - data2[\"us better %\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.472132Z",
     "iopub.status.busy": "2023-02-27T12:23:56.471699Z",
     "iopub.status.idle": "2023-02-27T12:23:56.473447Z",
     "shell.execute_reply": "2023-02-27T12:23:56.473890Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "cleaned = data.copy()\n",
    "cleaned = cleaned.melt(id_vars = [\"length\", \"band width\", \"max size\"], value_vars = [\"us better %\", \"other better %\", \"equal %\"])\n",
    "cleaned[\"variable\"] = cleaned[\"variable\"].map({\"us better %\": \"ours better %\", \"other better %\": \"adaptive banding better %\", \"equal %\": \"equal %\"})\n",
    "\n",
    "cleaned2 = data2.copy()\n",
    "cleaned2 = cleaned2.melt(id_vars = [\"length\", \"band width\", \"max size\"], value_vars = [\"us better %\", \"other better %\", \"equal %\"])\n",
    "cleaned2[\"variable\"] = cleaned2[\"variable\"].map({\"us better %\": \"ours better %\", \"other better %\": \"static banding better %\", \"equal %\": \"equal %\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.476845Z",
     "iopub.status.busy": "2023-02-27T12:23:56.476407Z",
     "iopub.status.idle": "2023-02-27T12:23:56.482844Z",
     "shell.execute_reply": "2023-02-27T12:23:56.483334Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "order = {\"ours better %\": 0, \"equal %\": 1, \"adaptive banding better %\": 2}\n",
    "cleaned[\"order\"] = cleaned.apply(lambda r: order[r[\"variable\"]], axis = 1)\n",
    "\n",
    "order = {\"ours better %\": 0, \"equal %\": 1, \"static banding better %\": 2}\n",
    "cleaned2[\"order\"] = cleaned2.apply(lambda r: order[r[\"variable\"]], axis = 1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Comparison with Adaptive Banding"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:56.501924Z",
     "iopub.status.busy": "2023-02-27T12:23:56.501532Z",
     "iopub.status.idle": "2023-02-27T12:23:57.300380Z",
     "shell.execute_reply": "2023-02-27T12:23:57.300890Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-4732678a56814bad97a681c2e528bbaa\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-4732678a56814bad97a681c2e528bbaa\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-4732678a56814bad97a681c2e528bbaa\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/f7e52a5b1dd8fc8c1d16da984635a308.json\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"variable\", \"sort\": {\"field\": \"order\"}, \"title\": \"\"}, \"order\": {\"type\": \"quantitative\", \"field\": \"order\"}, \"row\": {\"type\": \"nominal\", \"field\": \"max size\"}, \"x\": {\"type\": \"nominal\", \"field\": \"length\"}, \"y\": {\"type\": \"quantitative\", \"aggregate\": \"sum\", \"axis\": {\"format\": \"%\", \"title\": \"\"}, \"field\": \"value\"}}, \"height\": 100, \"width\": 100, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(cleaned).mark_bar().encode(\n",
    "    x = \"length\",\n",
    "    y = alt.Y(\"sum(value)\", axis = alt.Axis(title = \"\", format = \"%\")),\n",
    "    color = alt.Color(\"variable\", title = \"\", sort = alt.EncodingSortField(field = \"order\")),\n",
    "    row = \"max size:N\",\n",
    "    order = \"order\"\n",
    ").properties(\n",
    "    width = 100,\n",
    "    height = 100\n",
    ")\n",
    "save(c, \"compare_adaptive_banding.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Comparison with Static Banding"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:57.318689Z",
     "iopub.status.busy": "2023-02-27T12:23:57.315958Z",
     "iopub.status.idle": "2023-02-27T12:23:58.098490Z",
     "shell.execute_reply": "2023-02-27T12:23:58.098939Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-32e56b4544e44831a7e3fc3d88332deb\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-32e56b4544e44831a7e3fc3d88332deb\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-32e56b4544e44831a7e3fc3d88332deb\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"url\": \"http://localhost:19485/eb245f66676f282aedfdc4ad08370282.json\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"variable\", \"sort\": {\"field\": \"order\"}, \"title\": \"\"}, \"column\": {\"type\": \"nominal\", \"field\": \"band width\", \"sort\": [\"256\", \"2048\"], \"title\": \"static band width\"}, \"order\": {\"type\": \"quantitative\", \"field\": \"order\"}, \"row\": {\"type\": \"nominal\", \"field\": \"max size\", \"title\": \"max block size\"}, \"x\": {\"type\": \"nominal\", \"field\": \"length\"}, \"y\": {\"type\": \"quantitative\", \"aggregate\": \"sum\", \"axis\": {\"format\": \"%\", \"title\": \"\"}, \"field\": \"value\"}}, \"height\": 100, \"width\": 100, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(cleaned2).mark_bar().encode(\n",
    "    x = \"length\",\n",
    "    y = alt.Y(\"sum(value)\", axis = alt.Axis(title = \"\", format = \"%\")),\n",
    "    color = alt.Color(\"variable\", title = \"\", sort = alt.EncodingSortField(field = \"order\")),\n",
    "    row = alt.Row(\"max size:N\", title = \"max block size\"),\n",
    "    column = alt.Column(\"band width:N\", title = \"static band width\", sort = [\"256\", \"2048\"]),\n",
    "    order = \"order\"\n",
    ").properties(\n",
    "    width = 100,\n",
    "    height = 100\n",
    ")\n",
    "save(c, \"compare_diagonal.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Sequence-to-Profile Alignment Accuracy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:23:58.101943Z",
     "iopub.status.busy": "2023-02-27T12:23:58.101536Z",
     "iopub.status.idle": "2023-02-27T12:24:08.316396Z",
     "shell.execute_reply": "2023-02-27T12:24:08.316843Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['size, correct',\n",
       " '32-32, 9656',\n",
       " '32-64, 10724',\n",
       " '32-128, 11083',\n",
       " '128-128, 11107',\n",
       " '2048-2048, 11160',\n",
       " '# compared to 2048-2048',\n",
       " '# Done!']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = !cd .. && cargo run --example pssm_accuracy --release --features simd_avx2 --quiet\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:08.319661Z",
     "iopub.status.busy": "2023-02-27T12:24:08.319241Z",
     "iopub.status.idle": "2023-02-27T12:24:08.325836Z",
     "shell.execute_reply": "2023-02-27T12:24:08.326268Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>size</th>\n",
       "      <th>correct</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32-32</td>\n",
       "      <td>9656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>32-64</td>\n",
       "      <td>10724</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>32-128</td>\n",
       "      <td>11083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>128-128</td>\n",
       "      <td>11107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2048-2048</td>\n",
       "      <td>11160</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        size  correct\n",
       "0      32-32     9656\n",
       "1      32-64    10724\n",
       "2     32-128    11083\n",
       "3    128-128    11107\n",
       "4  2048-2048    11160"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = csv_to_pandas(output)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:08.332263Z",
     "iopub.status.busy": "2023-02-27T12:24:08.331634Z",
     "iopub.status.idle": "2023-02-27T12:24:08.333867Z",
     "shell.execute_reply": "2023-02-27T12:24:08.334303Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>size</th>\n",
       "      <th>correct</th>\n",
       "      <th>error rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32-32</td>\n",
       "      <td>9656</td>\n",
       "      <td>0.134767</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>32-64</td>\n",
       "      <td>10724</td>\n",
       "      <td>0.039068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>32-128</td>\n",
       "      <td>11083</td>\n",
       "      <td>0.006900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>128-128</td>\n",
       "      <td>11107</td>\n",
       "      <td>0.004749</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2048-2048</td>\n",
       "      <td>11160</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        size  correct  error rate\n",
       "0      32-32     9656    0.134767\n",
       "1      32-64    10724    0.039068\n",
       "2     32-128    11083    0.006900\n",
       "3    128-128    11107    0.004749\n",
       "4  2048-2048    11160    0.000000"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[\"error rate\"] = 1.0 - data[\"correct\"] / data.iloc[-1][\"correct\"]\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:08.339565Z",
     "iopub.status.busy": "2023-02-27T12:24:08.338950Z",
     "iopub.status.idle": "2023-02-27T12:24:08.341051Z",
     "shell.execute_reply": "2023-02-27T12:24:08.341462Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  block size error rate\n",
      "0      32-32      13.5%\n",
      "1      32-64       3.9%\n",
      "2     32-128       0.7%\n",
      "3    128-128       0.5%\n"
     ]
    }
   ],
   "source": [
    "table = data[[\"size\", \"error rate\"]]\n",
    "table = table.rename(columns = {\"size\": \"block size\"})\n",
    "table[\"error rate\"] = table[\"error rate\"].map(\"{:.1%}\".format)\n",
    "table = table.iloc[:-1]\n",
    "print(table)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SCOP Sequence-to-Profile Alignment Accuracy (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:08.358663Z",
     "iopub.status.busy": "2023-02-27T12:24:08.358250Z",
     "iopub.status.idle": "2023-02-27T12:24:09.111432Z",
     "shell.execute_reply": "2023-02-27T12:24:09.111871Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-20366ed0b2904c9bb6458215b2e6bdb6\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-20366ed0b2904c9bb6458215b2e6bdb6\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-20366ed0b2904c9bb6458215b2e6bdb6\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"size\", \"legend\": null, \"sort\": [\"32-32\", \"32-64\", \"32-128\", \"128-128\"]}, \"x\": {\"type\": \"nominal\", \"field\": \"size\", \"sort\": [\"32-32\", \"32-64\", \"32-128\", \"128-128\"], \"title\": \"block size\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"error rate\"}}, \"height\": 100, \"transform\": [{\"filter\": \"(datum.size !== '2048-2048')\"}], \"width\": 60}, {\"mark\": {\"type\": \"text\", \"dy\": -4, \"size\": 8}, \"encoding\": {\"color\": {\"value\": \"black\"}, \"text\": {\"type\": \"quantitative\", \"field\": \"error rate\", \"format\": \".1%\"}, \"x\": {\"type\": \"nominal\", \"field\": \"size\", \"sort\": [\"32-32\", \"32-64\", \"32-128\", \"128-128\"], \"title\": \"block size\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"format\": \"%\"}, \"field\": \"error rate\"}}, \"height\": 100, \"transform\": [{\"filter\": \"(datum.size !== '2048-2048')\"}], \"width\": 60}], \"data\": {\"url\": \"http://localhost:19485/1b1f4c02df4891d60bdd51aa599c95ef.json\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.LayerChart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_bar().encode(\n",
    "    x = alt.X(\"size\", title = \"block size\", sort = [\"32-32\", \"32-64\", \"32-128\", \"128-128\"]),\n",
    "    y = alt.Y(\"error rate\", axis = alt.Axis(format = \"%\")),\n",
    "    color = alt.Color(\"size\", sort = [\"32-32\", \"32-64\", \"32-128\", \"128-128\"], legend = None)\n",
    ").transform_filter(\n",
    "    datum.size != \"2048-2048\"\n",
    ").properties(\n",
    "    width = 60,\n",
    "    height = 100\n",
    ")\n",
    "t = c.mark_text(dy = -4, size = 8).encode(text = alt.Text(\"error rate\", format = \".1%\"), color = alt.value(\"black\"))\n",
    "c = c + t\n",
    "save(c, \"pssm_accuracy.pdf\")\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:09.114859Z",
     "iopub.status.busy": "2023-02-27T12:24:09.114460Z",
     "iopub.status.idle": "2023-02-27T12:24:09.462121Z",
     "shell.execute_reply": "2023-02-27T12:24:09.461747Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>size</th>\n",
       "      <th>seq len</th>\n",
       "      <th>profile len</th>\n",
       "      <th>pred score</th>\n",
       "      <th>true score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32-32</td>\n",
       "      <td>116</td>\n",
       "      <td>116</td>\n",
       "      <td>439</td>\n",
       "      <td>439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>32-64</td>\n",
       "      <td>116</td>\n",
       "      <td>116</td>\n",
       "      <td>439</td>\n",
       "      <td>439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>32-128</td>\n",
       "      <td>116</td>\n",
       "      <td>116</td>\n",
       "      <td>439</td>\n",
       "      <td>439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>128-128</td>\n",
       "      <td>116</td>\n",
       "      <td>116</td>\n",
       "      <td>439</td>\n",
       "      <td>439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2048-2048</td>\n",
       "      <td>116</td>\n",
       "      <td>116</td>\n",
       "      <td>439</td>\n",
       "      <td>439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55795</th>\n",
       "      <td>32-32</td>\n",
       "      <td>56</td>\n",
       "      <td>56</td>\n",
       "      <td>331</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55796</th>\n",
       "      <td>32-64</td>\n",
       "      <td>56</td>\n",
       "      <td>56</td>\n",
       "      <td>331</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55797</th>\n",
       "      <td>32-128</td>\n",
       "      <td>56</td>\n",
       "      <td>56</td>\n",
       "      <td>331</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55798</th>\n",
       "      <td>128-128</td>\n",
       "      <td>56</td>\n",
       "      <td>56</td>\n",
       "      <td>331</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55799</th>\n",
       "      <td>2048-2048</td>\n",
       "      <td>56</td>\n",
       "      <td>56</td>\n",
       "      <td>331</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>55800 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            size  seq len  profile len  pred score  true score\n",
       "0          32-32      116          116         439         439\n",
       "1          32-64      116          116         439         439\n",
       "2         32-128      116          116         439         439\n",
       "3        128-128      116          116         439         439\n",
       "4      2048-2048      116          116         439         439\n",
       "...          ...      ...          ...         ...         ...\n",
       "55795      32-32       56           56         331         331\n",
       "55796      32-64       56           56         331         331\n",
       "55797     32-128       56           56         331         331\n",
       "55798    128-128       56           56         331         331\n",
       "55799  2048-2048       56           56         331         331\n",
       "\n",
       "[55800 rows x 5 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = file_to_pandas(\"../data/pssm_accuracy.csv\")\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SCOP Sequence-to-Profile Alignment Our Score vs True Score (AVX2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-02-27T12:24:09.470619Z",
     "iopub.status.busy": "2023-02-27T12:24:09.470072Z",
     "iopub.status.idle": "2023-02-27T12:24:10.444888Z",
     "shell.execute_reply": "2023-02-27T12:24:10.445327Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-53b20c101bb34c20800e10076899fa3f\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-53b20c101bb34c20800e10076899fa3f\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-53b20c101bb34c20800e10076899fa3f\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"axis\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"header\": {\"labelFontSize\": 12, \"titleFontSize\": 12}, \"legend\": {\"labelFontSize\": 12, \"titleFontSize\": 12}}, \"data\": {\"url\": \"http://localhost:19485/6e2296e42628d6aa125c793b6dc24f85.json\"}, \"mark\": \"circle\", \"encoding\": {\"color\": {\"type\": \"quantitative\", \"aggregate\": \"count\", \"scale\": {\"scheme\": \"viridis\", \"type\": \"log\"}, \"title\": \"count\"}, \"column\": {\"type\": \"nominal\", \"field\": \"size\", \"header\": {\"orient\": \"bottom\"}, \"sort\": [\"32-32\", \"32-64\", \"32-128\"], \"title\": \"block size\"}, \"x\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"true score\"}, \"y\": {\"type\": \"quantitative\", \"bin\": {\"maxbins\": 50}, \"field\": \"pred score\"}}, \"height\": 200, \"transform\": [{\"filter\": \"((datum.size !== '2048-2048') && (datum.size !== '128-128'))\"}], \"width\": 200, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\"}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = alt.Chart(data).mark_circle().encode(\n",
    "    x = alt.X(\"true score\", bin = alt.Bin(maxbins = 50)),\n",
    "    y = alt.Y(\"pred score\", bin = alt.Bin(maxbins = 50)),\n",
    "    column = alt.Column(\"size\", title = \"block size\", header = alt.Header(orient = \"bottom\"), sort = [\"32-32\", \"32-64\", \"32-128\"]),\n",
    "    color = alt.Color(\"count():Q\", title = \"count\", scale = alt.Scale(type = \"log\", scheme = \"viridis\"))\n",
    ").transform_filter(\n",
    "    (datum.size != \"2048-2048\") & (datum.size != \"128-128\")\n",
    ").properties(\n",
    "    width = 200,\n",
    "    height = 200\n",
    ").configure_axis(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_header(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ").configure_legend(\n",
    "    titleFontSize = 12,\n",
    "    labelFontSize = 12\n",
    ")\n",
    "save(c, \"pssm_scores.pdf\")\n",
    "c"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
